//
//  MSShowerDetailBottomView.m
//  MS
//
//  Created by Yuan on 13-3-20.
//  Copyright (c) 2013年 He Yuan. All rights reserved.
//

#import "MSShowerDetailBottomView.h"

@implementation MSShowerDetailBottomView

- (id)initWithFrame:(CGRect)frame delegate:(id)delegate
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.userInteractionEnabled = YES;
        
        CGFloat btn_width = [UIImage imageNamed:@"pro_bottom_like_normal"].size.width/2;
        CGFloat btn_height = [UIImage imageNamed:@"pro_bottom_like_normal"].size.height/2;
        frame.size.height = btn_height;
        self.frame = frame;
        
        for (int i = 1 ; i < 6; i++)
        {
            NSString *imagename;
            switch (i)
            {
                case 1:
                    imagename = @"pro_bottom_like";
                    break;
                case 2:
                    imagename = @"pro_bottom_comment";
                    break;
                case 3:
                    imagename = @"pro_bottom_privatemessage";
                    break;
                case 4:
                    imagename = @"pro_bottom_fav";
                    break;
                case 5:
                    imagename = @"pro_bottom_share";
                    break;
                default:
                    break;
            }
            UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%@_normal",imagename]];
            UIImage *imagehighlighted = [UIImage imageNamed:[NSString stringWithFormat:@"%@_highlighted",imagename]];
            UIButton *btn = [MSTool createButton:CGRectMake((i-1)*btn_width, 0, btn_width, btn_height) action:@selector(toolBarItemActon:) delegate:delegate];
            btn.tag = i;
            [btn setImage:image forState:UIControlStateNormal];
            [btn setImage:imagehighlighted forState:UIControlStateHighlighted];
            [self addSubview:btn];
            
            if (i < 3)
            {
                UILabel *countLbl = [[UILabel alloc]initWithFrame:CGRectMake(40,13, 30, 16)];
                [countLbl setTextColor:[UIColor whiteColor]];
                [countLbl setFont:FONT_SMALL];
                [countLbl setText:HYLocalizedString(@"23")];
                [countLbl setBackgroundColor:[UIColor clearColor]];
                countLbl.tag = 100;
                [btn addSubview:countLbl];
            }            
        }
        // Initialization code
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
